package com.example.shop.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shop.bean.ProductBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductMapper extends BaseMapper<ProductBean> {
    @Select("select * from v_product2 where uid=#{uid} order by ctime desc")
    List<ProductBean> selectList(@Param("uid") int uid);

    @Select("select * from v_product2 order by id")
    List<ProductBean> selectView();

    @Select("select * from v_product2 where hot='热卖'")
    List<ProductBean> selectHot();

    @Select("select * from v_product2 where cid=#{cid} order by id desc")
    List<ProductBean> selectProduct(@Param("cid") int cid);

    //进行模糊查询
    @Select("select * from v_product2 where product like '%${key}%'")
    List<ProductBean> searchProduct(@Param("key") String key);
}
